<form action="while.php">
  请输入三角形的行数: <input type="text" name="triangleNum"> <button>确定</button><br>
</form>

<?php
$NUM=10;
if(isset($_GET["triangleNum"])){
  $NUM=$_GET["triangleNum"];
}
/**
 * 打印等腰三角形
 */
const N=15;
//行循环
$i=1;
while($i<=$NUM){
  //打印空格N-$i
  $j=1;
  while($j<=$NUM-$i){
    echo "&nbsp;&nbsp;";
    $j++;
  }
  //打印字符2*$i-1
  $t=1;
  while($t<=2*$i-1){
    echo "#";
    $t++;
  }
  //打印换行符
  echo "<br>";
  $i++;
}